
********************************************************************************
* FIGURE 1 - Distribution of favors
********************************************************************************

preserve

*the logic here is that i have two variables: black favors, hispanic favors, 
* and you can treat them as like time-variables if you reformat from wide to long
* which effectively stacks them 

*common favors item
gen base1 = favors12 
gen base2 = hispfavor12

*reshape for panel structure
reshape long base, i(caseid) j(year)

*labeling is necessary for the new item

*rename the x-axis categories
label define base 1 "Str agree" 2 "Agree" 3 "Neither" 4 "Disagree" 5 "Str disagree"
label value base base

*now we're going to parse the two items from each other using year...why? well, 
* because we "stacked" them...i know, i knwo. 

*variable for parsing black from hispanic
gen rrtype = year
label define rrtype 1 "Blacks" 2 "Hispanics"
label value rrtype rrtype

*we need to pull out liberals from conservatives, and by kicking these out using
* ideo12_3, we know we'll get the 2012 values, which is really what i care about
* for this snapshot since it is "time 1"

*liberals
catplot rrtype base if white==1 & ideo12_3==0, recast(bar) asyvars bar(1, bcolor(gs4) blcolor(black)) bar(2, bcolor(gs12) blcolor(black)) percent(rrtype) ///
 ytitle(" ") var2opts(label(alt)) aspect(1) plotregion(fcolor(white)) ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%", labsize(small) nogrid) title("(a) Liberals", size(small)) legend(pos(3) row(2) symxsize(3) forcesize size(small)) saving(lib_resent.gph, replace)
 
*conservatives
catplot rrtype base if white==1 & ideo12_3==2, recast(bar) asyvars bar(1, bcolor(gs4) blcolor(black)) bar(2, bcolor(gs12) blcolor(black)) percent(rrtype) ///
ytitle(" ") var2opts(label(alt))  aspect(1) plotregion(fcolor(white)) ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%" 60 "60%" 70 "70%" 80 "80%", labsize(small) nogrid) title("(b) Conservatives", size(small))  legend(pos(3) row(2) symxsize(3) forcesize size(small)) saving(con_resent.gph, replace)

*combining together
grc1leg lib_resent.gph con_resent.gph, col(2) pos(12) row(1) title("[Racial group] should do without special favors")

********************************************************************************
* FIGURE 2: Big policy graphic
********************************************************************************
********************************************************************************
* affirm action 
********************************************************************************
reg aa14_01 aa12_01 favors12_01 hispfavor12_01 pid12  ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight]
margins, dydx(favors12_01) post
est store aa_all_rr

reg aa14_01 aa12_01 favors12_01 hispfavor12_01 pid12  ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight]
margins, dydx(hispfavor12_01) post
est store aa_all_hisp

reg aa14_01 aa12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight]
margins, dydx(favors12_01) post
est store aa_lib_rr

reg aa14_01 aa12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store aa_lib_hisp

reg aa14_01 aa12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight]
margins, dydx(favors12_01) post
est store aa_con_rr

reg aa14_01 aa12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store aa_con_hisp

reg aa14_01 aa12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(favors12_01) post
est store aa_mod_rr

reg aa14_01 aa12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store aa_mod_hisp



********************************************************************************
* amnesty  
********************************************************************************
reg amnesty14 amnesty12 favors12_01 hispfavor12_01 pid12  ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(favors12_01) post
est store amnesty_all_rr

reg amnesty14 amnesty12 favors12_01 hispfavor12_01 pid12  ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store amnesty_all_hisp

reg amnesty14 amnesty12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(favors12_01) post
est store amnesty_lib_rr

reg amnesty14 amnesty12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store amnesty_lib_hisp

reg amnesty14 amnesty12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(favors12_01) post
est store amnesty_con_rr

reg amnesty14 amnesty12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store amnesty_con_hisp

reg amnesty14 amnesty12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(favors12_01) post
est store amnesty_mod_rr

reg amnesty14 amnesty12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store amnesty_mod_hisp


********************************************************************************
* no biz hiring illegals  
********************************************************************************
reg illegals14 illegals12 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(favors12_01) post
est store illegals_all_rr

reg illegals14 illegals12 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store illegals_all_hisp

reg illegals14 illegals12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(favors12_01) post
est store illegals_lib_rr

reg illegals14 illegals12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store illegals_lib_hisp

reg illegals14 illegals12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(favors12_01) post
est store illegals_con_rr

reg illegals14 illegals12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store illegals_con_hisp

reg illegals14 illegals12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(favors12_01) post
est store illegals_mod_rr

reg illegals14 illegals12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store illegals_mod_hisp

********************************************************************************
* abortion 
********************************************************************************
reg abort14_01 abort12_01 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight]
margins, dydx(favors12_01) post
est store abortion_all_rr

reg abort14_01 abort12_01 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight]
margins, dydx(hispfavor12_01) post
est store abortion_all_hisp

reg abort14_01 abort12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight]
margins, dydx(favors12_01) post
est store abortion_lib_rr

reg abort14_01 abort12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store abortion_lib_hisp

reg abort14_01 abort12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight]
margins, dydx(favors12_01) post
est store abortion_con_rr

reg abort14_01 abort12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store abortion_con_hisp

reg abort14_01 abort12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(favors12_01) post
est store abortion_mod_rr

reg abort14_01 abort12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store abortion_mod_hisp

********************************************************************************
* gun control 
********************************************************************************
reg guncontrol14_01 guncontrol12_01 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight]
margins, dydx(favors12_01) post
est store guncontrol_all_rr

reg guncontrol14_01 guncontrol12_01 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight]
margins, dydx(hispfavor12_01) post
est store guncontrol_all_hisp

reg guncontrol14_01 guncontrol12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight]
margins, dydx(favors12_01) post
est store guncontrol_lib_rr

reg guncontrol14_01 guncontrol12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store guncontrol_lib_hisp

reg guncontrol14_01 guncontrol12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight]
margins, dydx(favors12_01) post
est store guncontrol_con_rr

reg guncontrol14_01 guncontrol12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store guncontrol_con_hisp

reg guncontrol14_01 guncontrol12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(favors12_01) post
est store guncontrol_mod_rr

reg guncontrol14_01 guncontrol12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store guncontrol_mod_hisp

********************************************************************************
* raise taxes 
********************************************************************************
reg raisetaxes14 raisetaxes12 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(favors12_01) post
est store taxes_all_rr

reg raisetaxes14 raisetaxes12 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store taxes_all_hisp

reg raisetaxes14 raisetaxes12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(favors12_01) post
est store taxes_lib_rr

reg raisetaxes14 raisetaxes12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store taxes_lib_hisp

reg raisetaxes14 raisetaxes12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(favors12_01) post
est store taxes_con_rr

reg raisetaxes14 raisetaxes12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store taxes_con_hisp

reg raisetaxes14 raisetaxes12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(favors12_01) post
est store taxes_mod_rr

reg raisetaxes14 raisetaxes12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store taxes_mod_hisp

********************************************************************************
* gay marriage 
********************************************************************************
reg gaymar14 gaymar12 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(favors12_01) post
est store gaymar_all_rr

reg gaymar14 gaymar12 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store gaymar_all_hisp

reg gaymar14 gaymar12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(favors12_01) post
est store gaymar_lib_rr

reg gaymar14 gaymar12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store gaymar_lib_hisp

reg gaymar14 gaymar12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(favors12_01) post
est store gaymar_con_rr

reg gaymar14 gaymar12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store gaymar_con_hisp

reg gaymar14 gaymar12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(favors12_01) post
est store gaymar_mod_rr

reg gaymar14 gaymar12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store gaymar_mod_hisp

********************************************************************************
* no birthright
********************************************************************************
reg birthright14 birthright12 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(favors12_01) post
est store birthright_all_rr

reg birthright14 birthright12 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store birthright_all_hisp

reg birthright14 birthright12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(favors12_01) post
est store birthright_lib_rr

reg birthright14 birthright12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store birthright_lib_hisp

reg birthright14 birthright12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(favors12_01) post
est store birthright_con_rr

reg birthright14 birthright12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight], robust
margins, dydx(hispfavor12_01) post
est store birthright_con_hisp

reg birthright14 birthright12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(favors12_01) post
est store birthright_mod_rr

reg birthright14 birthright12 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store birthright_mod_hisp


********************************************************************************
* graph - w/o moderates
********************************************************************************
coefplot /// birthright
(birthright_all_rr, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(birthright_lib_rr, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(birthright_con_rr, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
(birthright_all_hisp, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(birthright_lib_hisp, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(birthright_con_hisp, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
, bylabel("(1) No birth citizenship") || ///
/// illegal buisness hiring
(illegals_all_rr, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(illegals_lib_rr, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(illegals_con_rr,  msymbol(D) mcolor(red) ciopts(lcolor(green))) ///
(illegals_all_hisp, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(illegals_lib_hisp, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(illegals_con_hisp,  msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
, bylabel("(2) No business fines") || ///
/// affirmative action
(aa_all_rr, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(aa_lib_rr, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(aa_con_rr, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
(aa_all_hisp, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(aa_lib_hisp, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(aa_con_hisp, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
, bylabel("(3) Oppose Affirm Action") || ///
/// gun control 
(guncontrol_all_rr, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(guncontrol_lib_rr, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(guncontrol_con_rr, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
(guncontrol_all_hisp, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(guncontrol_lib_hisp, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(guncontrol_con_hisp, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
, bylabel("(4) Oppose gun control") || ///
/// abortion
(abortion_all_rr, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(abortion_lib_rr, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(abortion_con_rr, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
(abortion_all_hisp, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(abortion_lib_hisp, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(abortion_con_hisp, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
, bylabel("(5) Oppose abortion")  || ///
/// taxes 
(taxes_all_rr, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(taxes_lib_rr, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(taxes_con_rr, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
(taxes_all_hisp, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(taxes_lib_hisp, mlcolor(blue) mcolor(white)  ciopts(lcolor(blue))) ///
(taxes_con_hisp, msymbol(D) mcolor(red) ciopts(lcolor(red))) ///
, bylabel("(6) Raise taxes") xlabel( 1 "Black " 2 "Hispanic ", notick) vertical xscale(r(0.25 2.75)) yline(0, lp(dash) lc(red)) byopts(col(4)) legend(order(2 "All respondents" 4 "Liberals" 6 "Conservatives") col(2) color(gs4) size(small) symxsize(2) forcesize) plotregion(lcolor(black)) xlabel(, labcolor(gs4)) ylabel(, labcolor(gs4)) ytitle("Marginal effect", color(gs4))

********************************************************************************
* FIGURE 3 - Obama approval
********************************************************************************

*all black
reg obama14_01 obama12_01 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight]
margins, dydx(favors12_01) post
est store obama_all_rr

*all hisp
reg obama14_01 obama12_01 favors12_01 hispfavor12_01 pid12 ideo12 age01 educ01 male newsint01 notpolactiv income if white==1 [pweight=weight]
margins, dydx(hispfavor12_01) post
est store obama_all_hisp

*lib black
reg obama14_01 obama12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight]
margins, dydx(favors12_01) post
est store obama_lib_rr

*con black
reg obama14_01 obama12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight]
margins, dydx(favors12_01) post
est store obama_con_rr

*mod black
reg obama14_01 obama12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(favors12_01) post
est store obama_mod_rr

*lib hisp
reg obama14_01 obama12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 0  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store obama_lib_hisp
*lib hisp

*con hisp
reg obama14_01 obama12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 2  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store obama_con_hisp

*mod hisp
reg obama14_01 obama12_01 favors12_01 hispfavor12_01 pid12  age01 educ01 male newsint01 notpolactiv income if white==1 & ideo12_3== 1  [pweight=weight]
margins, dydx(hispfavor12_01) post
est store obama_mod_hisp 

*figure
coefplot (obama_all_rr,  msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(obama_lib_rr, mlcolor(blue) msymbol(O) mcolor(white) ciopts(lcolor(blue))) ///
(obama_con_rr, mcolor(red) msymbol(D) ciopts(lcolor(red))) ///
(obama_all_hisp, msymbol(X) mcolor(black) ciopts(lcolor(black))) ///
(obama_lib_hisp, mlcolor(blue) msymbol(O) mcolor(white) ciopts(lcolor(blue))) ///
(obama_con_hisp, mcolor(red) msymbol(D) ciopts(lcolor(red))), bylabel("Obama approval") ///
ytitle("Marginal effect", color(gs4)) xlabel(.75 "Black-favors" 2.25 "Hispanic-favors", labcolor(gs4)) ///
vertical yline(0, lp(dash) lc(red)) xlabel(, notick) xscale(r(0 3)) legend(order(2 "All respondents" 4 "Liberals" 6 "Conservatives") pos(3) row(6) color(gs4)) ///
ylabel(, labcolor(gs4) nogrid) plotregion(lcolor(black)) saving(margfxobama.gph, replace)
